Seen a few posts regarding this problem so I tried oiling the original put it all back together and it didn't help at all. Next I tried replacing the mechanism.
Upon fitting the new lock I tested it with door skin off and it actually worked although I needed to press lock twice on the fob. I was happy with this at least it was now locking. After putting the door back together and closing the door I tried locking again but it wasn't locking now!!!
Tested the car for fault codes but it was clear. Only thing I can think of is the wiring is loose or corroded where the door crosses over to the main body of the car (in the black rubber cover). This would then explain why it has worked sometimes but then stops working.
Does anybody have any ideas as to how I could test the wiring loom, how to access it through the rubber cover? Do I need to take interior trim panels off the b pillar to get to where the wiring goes? Any help appreciated as an unlocked car in the road is causing me sleepless nights literally.